<?php
namespace app\common\controller;
use app\common\controller\Core;

/**
 * 接口核心类
 */
class ApiCore extends Core{
	//错误信息
	public $_Msg = '';
	//系统化
    protected function initialize(){
		$this->IsAuth = false;
        parent::initialize();
    }
	//Code验证
    public function _VerifyCode($Str='',$_VerifyLogin = false){
        if($_VerifyLogin && !$this->_VerifyLogin()){
			return false;
        }
		$Result = _AutoCode($Str,true);
		return $Result;
    }
	//登录验证
	public function _VerifyLogin(){
        if($this->_Uid){
			return true;
        }else{
			$this->_Msg = '未登录,无法调用';
			return false;
		}
    }
	//Auth验证
    public function _VerifyAuth($_Mca=false){
        if(!$this->_VerifyLogin()){
			return false;
        }
		if(!$_Mca){
			$_Mca = $this->_MCA;
		}
		//当前网关是否需要进行auth验证
		if(!_CheckAuth($_Mca,$this->_Uid)){
			$this->_Msg = lang('no_check_auth');
			return false;
		}
		return true;
    }
    
    public function _empty($name){
		return '请求错误';
    }
}